From a772322f4c16038751bc9fb565a59c4faaaed8b3 Mon Sep 17 00:00:00 2001 From: Chong Yidong Date: Fri, 20 Apr 2012 18:37:57 +0800 Subject: [PATCH] Fix emacsclient/server behavior under --without-x. * lib-src/emacsclient.c (main): Send -tty to Emacs under more circumstanced (Bug#8314). * lisp/server.el (server-process-filter): Only try to open a window system frame if compiled with graphical support (Bug#8314). --- lib-src/ChangeLog | 1 + lib-src/emacsclient.c | 8 ++++---- lisp/ChangeLog | 2 ++ lisp/server.el | 8 +++++--- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 4801a6dff49..b4c72d54dc1 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -2,6 +2,7 @@ * emacsclient.c (decode_options): Move -t -n corner case handling into server.el (Bug#11102). + (main): Send -tty to Emacs under more circumstanced (Bug#8314). 2012-04-18 Paul Eggert diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 48b4384d487..ea55398306b 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -1658,10 +1658,10 @@ main (int argc, char **argv) send_to_emacs (emacs_socket, " "); } - /* If using the current frame, send tty information to Emacs anyway. - In daemon mode, Emacs may need to occupy this tty if no other - frame is available. */ - if (tty || (current_frame && !eval)) + /* Unless we are certain we don't want to occupy the tty, send our + tty information to Emacs. For example, in daemon mode Emacs may + need to occupy this tty if no other frame is available. */ + if (!current_frame || !eval) { const char *tty_type, *tty_name; diff --git a/lisp/ChangeLog b/lisp/ChangeLog index fb7026e0669..253652ab23e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -4,6 +4,8 @@ is a string and there are no files to open (Bug#2825). (server-create-window-system-frame, server-create-tty-frame): Don't switch buffers here. + (server-process-filter): Only try to open a window system frame if + compiled with graphical support (Bug#8314). 2012-04-20 Dan Nicolaescu diff --git a/lisp/server.el b/lisp/server.el index f9c8ea5c577..1e2f458ac9c 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1076,8 +1076,9 @@ The following commands are accepted by the client: ;; -window-system: Open a new X frame. (`"-window-system" - (setq dontkill t) - (setq tty-name 'window-system)) + (if (fboundp 'x-create-frame) + (setq dontkill t + tty-name 'window-system))) ;; -resume: Resume a suspended tty frame. (`"-resume" @@ -1105,7 +1106,8 @@ The following commands are accepted by the client: (setq dontkill t) (pop args-left)) - ;; -tty DEVICE-NAME TYPE: Open a new tty frame at the client. + ;; -tty DEVICE-NAME TYPE: Open a new tty frame. + ;; (But if we see -window-system later, use that.) (`"-tty" (setq tty-name (pop args-left) tty-type (pop args-left) -- 2.30.2